package com.study.www.model.mapper;

import com.study.www.model.FileChunk;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface FileChunkRepository extends JpaRepository<FileChunk,Long> {

    @Modifying
    @Query("SELECT f FROM FileChunk f where f.identifier=:identifier")
    List<FileChunk> findFileChunkParamByMd5(@Param("identifier")String identifier);

    @Query(nativeQuery = true,value = "SELECT count(*) FROM file_chunk where identifier=?1")
    Integer findCountByMd5(String identifier);

//    int insertFileChunk(FileChunk fileChunk);
}
